<?php
/*Problem Domain
To Test the UserSession mapping class access object
*/
include_once '../UserSessionDAOImpl.php';
include_once '../../model/User.php';
include_once '../../model/TrainingSession.php';
include_once '../../model/UserSession.php';

class TestUseDAOImpl extends PHPUnit_Framework_TestCase
{
	public function testUserDAOImplObject()
	{
		$dbobj = new UserSessionDAOImpl();
		$usr1  = new User("mohsin.sayyed@springcomputing.in", "******", "trainee");
		$sess1 = new TrainingSession("phpsession", "ketul", date("2015-02-08 11:14:15.638276"), TrainingSession::AVAILABLE, 'arrays,functions');

		$us1 = new UserSession($usr1->getId(), $sess1->getId(), UserSession::PENDING);
		$conn = $dbobj->getConnection(); 

		$dbobj->saveOrUpdate($us1);

		$arr = $dbobj->listUserSession();
		$lst = $arr->getArrayList();
		$this->assertEquals(UserSession::PENDING , $lst[0]->getStatus());
	}
}
?>
